Ext.define('PJ.view.coursecompletionrates.UserList', {
    extend: 'AM.default.DefaultList',
	alias: 'widget.courseUserList',
	selModel: {
	       selType: '',
	       // 设置为只能通过复选框选中行
	       checkOnly: true
	 },
    initComponent: function(){
        this.columns = [{
        	header: '学员帐号',
        	dataIndex: 't.user.loginID',
        	width: 110,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
        	header: '姓名',
        	dataIndex: 't.userName',
        	width: 110,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '性别',
            dataIndex: 't.sexCode.dataName',
            width: 50
        },{
            header: '年龄',
            dataIndex: 't.birthday',
            flex:1,
            minWidth: 50,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '民族',
            dataIndex: 't.folkCode.dataName',
            flex:1,
            minWidth: 80,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '单位及职务',
            dataIndex: 't.dutyRemark',
            flex:1,
            minWidth: 120,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '联系电话',
            dataIndex: 't.mobileTelephone',
            flex:1,
            minWidth: 120,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }, {
            header: '备注',
            dataIndex: 't.remark',
            flex:1,
            minWidth: 120,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        }];
        this.store = Ext.create('PJ.' + prototype + '.coursecompletionrates.UserList', {
            isLoad: false
        });
        this.loadType = gj_onlineLearning_constant.loadType;
        this.callParent(arguments);
    },
    //导出
    onExportClick: function(){
    	var me = this;
        var store = me.getStore();
        var params=store.proxy.extraParams;
        var href=store.exportUrl + "?searchClassIds=" + me.up('window').classId;
        for(var param in params){
        	if(params[param] === undefined){
        		href+="&"+param+"=";
        	}else{
        		href+="&"+param+"="+params[param];
        	}
        }
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
    },
    listeners: {
        viewready: function(){
        	var me = this;
            this.addDocked([{
                xtype: 'toolbar',
                dock: 'top',
                displayInfo: true,
                items: [{
                    text: '导出',
                    iconCls: 'deriveIco',
                    itemId: this.oldId + "Export",
                    disabled: false,
                    scope: this,
                    handler: this.onExportClick
                }]
            }]);
            var me = this;
            // 触发权限过滤事件
            me.fireEvent("permission", this);
            var params = me.store.proxy.extraParams;
            var newParams = {
            		searchClassID: me.up('window').classId,
            		auditingState: 1
            };
            Ext.apply(params, newParams);
            this.store.isLoad = true;
            this.store.load();
        }
    }
});
